#!/bin/bash

# Simple MCP Server 启动脚本

echo "Simple MCP Server 启动工具"
echo "============================="

# 默认端口
PORT=${1:-9000}

echo "端口: $PORT"
echo "编译项目..."

# 编译项目
mvn clean compile -q

if [ $? -ne 0 ]; then
    echo "编译失败!"
    exit 1
fi

echo "启动 MCP 服务器..."
echo "WebSocket URL: ws://localhost:$PORT"
echo "按 Ctrl+C 停止服务器"
echo ""

# 运行MCP服务器
mvn exec:java \
    -Dexec.mainClass="com.boulderai.mcp.server.SimpleMcpServer" \
    -Dexec.args="$PORT" \
    -q

echo ""
echo "MCP服务器已停止"